import { CHANGE_PLAYING_MUSIC_SRC, CHANGE_PLAYING_MUSIC_PLAN, CHANGE_PLAYING_MUSIC_LYRIC,
  CHANGE_PLAYING_MUSIC_AFTER, CHANGE_PLAYING_MUSIC_LATER
 } from '../types/common'

const mp3Url =  'http://tyst.migu.cn/public/ringmaker01/n17/2017/07/无损/2009年06月26日博尔普斯/flac/听妈妈的话-周杰伦.flac'
const duration = 220839
const initState = {
  id: 1,
  name: '听妈妈的话-周杰伦',
  img: 'http://p2.music.126.net/NSXAZrbV9wuT3z9SOKQKCQ==/109951165826787376.jpg?param=240y240',
  mp3Url: 'http://tyst.migu.cn/public/ringmaker01/n17/2017/07/无损/2009年06月26日博尔普斯/flac/听妈妈的话-周杰伦.flac',
  duration: 220839,
}

const common = (state = initState, action) => {
  const { type, data } = action
  switch(type) {
    case CHANGE_PLAYING_MUSIC_SRC:
      console.log('zhii')
      return { ...state,...data, mp3Url, duration }
    case CHANGE_PLAYING_MUSIC_PLAN:
      return {...state, playIngList: {
        ...data
      }};
    case CHANGE_PLAYING_MUSIC_LYRIC:
      return { ...initState, ...data }
    case CHANGE_PLAYING_MUSIC_AFTER:
      return { ...initState, ...data }
    default:
      return state;
  } 
}

export default common